package es.unex.meigas.gvsig.extensions;

import java.awt.Frame;
import java.io.File;

import com.iver.andami.PluginServices;
import com.iver.andami.plugins.Extension;

import es.unex.meigas.core.Meigas;
import es.unex.meigas.gvsig.core.gvOutputFactory;
import es.unex.meigas.gvsig.gui.gvGISConnection;
import es.unex.meigas.gvsig.gui.gvGUIFactory;
import es.unex.meigas.gvsig.gui.gvInputFactory;

public class MeigasExtension extends Extension {

	public void initialize(){

		String sFolder = System.getProperty("user.dir") + File.separator + "gvSIG"
			+ File.separator + "extensiones" + File.separator + "es.unex.meigas";
		Meigas.setOutputFactory(new gvOutputFactory());
		Meigas.setGUIFactory(new gvGUIFactory());
		Meigas.setInputFactory(new gvInputFactory());
		Meigas.setGISConnection(new gvGISConnection());
		Meigas.setMainFrame(((Frame)PluginServices.getMainFrame()));
		Meigas.setDataFolder(sFolder);
		Meigas.initialize();

	}

	public void execute(String actionCommand) {

		Meigas.getGUIFactory().showMeigasWindow();

	}

	public boolean isEnabled() {

		return true;

	}

	public boolean isVisible() {

		return true;

	}

}